//
//  ZxFMMyLisitenViewController.m
//  XIMaLaYaFM
//
//  Created by fanzhuxian on 2017/8/26.
//  Copyright © 2017年 FanZhuxian. All rights reserved.
//

#import "ZxFMMyLisitenViewController.h"

#import "ZXFmMyListenView.h"
#import "SelectedView.h"

#import "ZxFmMyReadViewController.h"
#import "ZxFmAddReadViewController.h"

@interface ZxFMMyLisitenViewController ()

@end

@implementation ZxFMMyLisitenViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    // 设置navBar
    [self setupNavBar];
    
    ZXFmMyListenView * subView = [[ZXFmMyListenView alloc] initWithFrame:CGRectMake(0, 0, DEVICE_SCREEN_WIDTH, 100)];
    [self.view addSubview:subView];
    
    [self setupViews];
}

#pragma mark - 初始化navBar
- (void)setupNavBar{
    
    // 点击了消息
    UIBarButtonItem * leftItem = [UIBarButtonItem itemWithImage:[UIImage imageNamed:@"top_message_n"] highlightedImage:[UIImage imageNamed:@"top_message_n"] target:self action:@selector(didClickLeft)];
    
    // 历史
    UIBarButtonItem * historyItem = [UIBarButtonItem itemWithImage:[UIImage imageNamed:@"top_history_n"] highlightedImage:[UIImage imageNamed:@"top_history_n"] target:self action:@selector(didClickHistory)];
    
    // 下载
    UIBarButtonItem * downloadItem = [UIBarButtonItem itemWithImage:[UIImage imageNamed:@"top_download_n"] highlightedImage:[UIImage imageNamed:@"top_download_n"] target:self action:@selector(didClickDownload)];

    self.navigationItem.leftBarButtonItem = leftItem;
    self.navigationItem.rightBarButtonItems = @[downloadItem,historyItem];
    
    self.navigationItem.title = @"我听";
}

- (void)setupViews {
    
    NSArray * nameArr = @[@"我的订阅", @"推荐订阅"];
    ZxFmMyReadViewController * myReadVC = [[ZxFmMyReadViewController alloc] init];
    ZxFmAddReadViewController * addReadVC = [[ZxFmAddReadViewController alloc] init];
    NSArray * controllersArr = @[myReadVC, addReadVC];
    
    SelectedView * selectedView = [[SelectedView alloc] initWithFrame:CGRectMake(0, 120, DEVICE_SCREEN_WIDTH, DEVICE_SCREEN_HEIGHT - 64) buttonName:nameArr controllers:controllersArr parentController:self];
    [self.view addSubview:selectedView];
}

#pragma mark 点击方法
- (void)didClickLeft {
    NSLog(@"点击了消息");
}

- (void)didClickHistory {
    
    NSLog(@"点击了历史");
}

- (void)didClickDownload {
    
    NSLog(@"点击了下载");
}

@end
